package club.info.section1_creational.part01_factory;

/**
 * @Description :
 * @Author : Zhang Pc
 * @Date : 2020/11/28
 */
public class CarFactory {

    public Car getCar(CarTypeEnum carTypeEnum){
        if (carTypeEnum == null) {
            return null;
        }

        Car car;

        switch (carTypeEnum) {
            case BENZ:
                car = new Benz();
                break;
            case BMW:
                car = new Bmw();
                break;
            case AUDI:
                car = new Audi();
                break;
            default:
                car = null;
                break;
        }
        return car;
    }
}
